﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using 个人博客.SqlViews;

namespace 个人博客.instrumentClass
{
    //登录判断
    public class enter
    {
        //登录
        public string DengLu(int number, string pwd)
        {
            using (var db = new Model1())
            {
                //判断是否封禁
                var banned = db.Blogs_Jurisdiction.FirstOrDefault(u => u.jur_number == number);
                if (banned.jur_banned != "true")
                {
                    return "该账号已被封禁";
                }
                var list = db.Blogs_Account.FirstOrDefault(u => u.acc_number == number);
                if (list == null)
                {
                    return "该账号未注册";
                }
                if (list.acc_pwd != pwd)
                {
                    return "密码错误";
                }
                return "正确";
            }
        }
        //获取用户名
        public string gainName(int number)
        {
            using (var db = new Model1())
            {
                var list = db.Blogs_Account.FirstOrDefault(u => u.acc_number == number);
                return list.acc_name;
            }
        }
    }
}